-- Functions created to resolve the 99 questions found at: 
-- http://www.haskell.org/haskellwiki/99_questions
--


-- Problem 1
-- Find the last element of a list
--
-- Ex: myLast [1,2,3,4]
-- 4
--
-- Ex: myLast ['x', 'y', 'z']
-- 'z'

t_last :: [a] -> a
t_last [x] = x
t_last (_:xs) = t_last xs

-- ou por indice
t_last' x = x !! (length x -1)

-- ou por malabarismos
t_last'' = head . reverse
